home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / hplip / ui4 / nodevicesdialog.py < prev    next >
Text File  |  2009-10-09  |  2KB  |  82 lines

  1. # -*- coding: utf-8 -*-
  2. #
  3. # (c) Copyright 2001-2008 Hewlett-Packard Development Company, L.P.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  18. #
  19. # Authors: Don Welch
  20. #
  21.  
  22.  
  23. # Local
  24. from base.g import *
  25. from base import device, utils
  26. from ui_utils import *
  27.  
  28. # Qt
  29. from PyQt4.QtCore import *
  30. from PyQt4.QtGui import *
  31.  
  32. # Ui
  33. from nodevicesdialog_base import Ui_NoDevicesDialog_base
  34.  
  35.  
  36. class NoDevicesDialog(QDialog, Ui_NoDevicesDialog_base):
  37.     def __init__(self, parent):
  38.         QDialog.__init__(self, parent)
  39.         self.setupUi(self)
  40.         self.initUi()
  41.  
  42.  
  43.     def initUi(self):
  44.         self.connect(self.SetupButton, SIGNAL("clicked()"), self.SetupButton_clicked)
  45.         self.connect(self.CUPSButton, SIGNAL("clicked()"), self.CUPSButton_clicked)
  46.         self.connect(self.CloseButton, SIGNAL("clicked()"), self.CloseButton_clicked)
  47.         self.Icon.setPixmap(load_pixmap("warning", '32x32'))
  48.  
  49.  
  50.     def SetupButton_clicked(self):
  51.         self.close()
  52.  
  53.         if utils.which('hp-setup'):
  54.             cmd = 'hp-setup -u'
  55.         else:
  56.             cmd = 'python ./setup.py -u'
  57.  
  58.         log.debug(cmd)
  59.         utils.run(cmd, log_output=True, password_func=None, timeout=1)
  60.  
  61.         try:
  62.             self.parent().rescanDevices()
  63.         except Error:
  64.             QMessageBox.critical(self,
  65.                                     self.windowTitle(),
  66.                                     self.__tr("<b>An error occurred.</b><p>Please re-start the Device Manager and try again."),
  67.                                     QMessageBox.Ok,
  68.                                     QMessageBox.NoButton,
  69.                                     QMessageBox.NoButton)
  70.  
  71.  
  72.     def CUPSButton_clicked(self):
  73.         self.close()
  74.         utils.openURL("http://localhost:631/admin?op=add-printer")
  75.  
  76.  
  77.     def CloseButton_clicked(self):
  78.         self.close()
  79.  
  80.  
  81.  
  82.